<template>
  <el-card style="margin-bottom:20px;">
    <div slot="header" class="clearfix">
      <span>个人信息</span>
    </div>

    <div class="user-profile">
      <div class="box-center">
        <pan-thumb :image="avatar" :height="'100px'" :width="'100px'" :hoverable="false">
          <div>Hello</div>
          {{ userInfo.name }}
        </pan-thumb>
      </div>
      <div class="box-center">
        <div class="user-name text-center">{{ userInfo.name }}</div>
        <div class="user-role text-center text-muted">{{ userInfo.mobile }}</div>
      </div>
      <div style="display: flex; justify-content: space-between;">
        <div>会员等级：{{ userInfo.levelText }}</div>
        <div>会员积分：{{ userInfo.score }}</div>
      </div>
    </div>

    <div class="user-bio">
      <div class="user-education user-bio-section">
        <div class="user-bio-section-header">
          <svg-icon icon-class="education" /><span>企业基本信息</span><i style="float:right;font-size: 18px;"
            class="el-icon-edit" v-if="show_info_base" />
        </div>
        <div class="user-bio-section-body">
          <div class="company-info">
            公司名称：{{userInfo.companyName}}
          </div>
          <div class="company-info">
            联系方式：{{userInfo.companyContactName}}<span style="margin-left:10px"></span>{{userInfo.companyContactMobile}}
          </div>
          <div class="company-info">
            企业邮箱：{{userInfo.companyEmail}}
          </div>
          <div class="company-info">
            企业电话：{{userInfo.companyMobile}}
          </div>
          <div class="company-info">
            企业官网：<a style="color:#1890ff;text-decoration: underline" v-if="userInfo.companySite"
              :href="userInfo.companySite" target="break">{{userInfo.companySite}}</a>
          </div>
        </div>
      </div>

      <div class="user-skills user-bio-section">
        <div class="user-bio-section-header">
          <svg-icon icon-class="skill" /><span>企业认证信息</span><i style="float:right;font-size: 18px;" class="el-icon-edit"
             v-if="show_info_auth" />
        </div>
        <div class="auth-warpper">
					<p>
					 合同编号：{{userInfo.contractNo}}
					</p>
          <p>
            统一社会信用代码：{{userInfo.authNo}}
          </p>
          <p>
            营业执照图片：<el-image v-if="userInfo.authImage" style="width: 100px; height: 100px" :src="userInfo.authImage"
              :preview-src-list="[userInfo.authImage]">
            </el-image>
          </p>
          <p class="authStatus">{{userInfo.statusText}}</p>
        </div>
      </div>
    </div>
  </el-card>
</template>

<script>
import { mapGetters } from 'vuex'
import PanThumb from '@/components/PanThumb'

export default {
  components: { PanThumb },
  props: {
    show_info_base: {
      type: Boolean,
      default: false
    },
    show_info_auth: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'avatar',
      'roles',
      'userInfo'
    ])
  },
  methods: {
    changeTab(name) {
      this.$emit('changeTab', name)
    }
  }
}
</script>

<style lang="scss" scoped>
.box-center {
  margin: 0 auto;
  display: table;
}

.text-muted {
  color: #777;
}
.company-info {
  line-height: 1.5;
  color: #333;
  display: flex;
}
.auth-warpper {
  line-height: 1.5;
  color: #333;
  p {
    display: flex;
  }
  .authStatus {
    font-size: 18px;
  }
}
.el-image-viewer__close {
  color: #fff;
}
.user-profile {
  .user-name {
    font-weight: bold;
  }

  .box-center {
    padding-top: 10px;
  }

  .user-role {
    padding-top: 10px;
    font-weight: 400;
    font-size: 14px;
  }

  .box-social {
    padding-top: 30px;

    .el-table {
      border-top: 1px solid #dfe6ec;
    }
  }

  .user-follow {
    padding-top: 20px;
  }
}

.user-bio {
  margin-top: 0px;
  color: #606266;

  span {
    padding-left: 4px;
  }

  .user-bio-section {
    font-size: 14px;
    padding: 15px 0;

    .user-bio-section-header {
      border-bottom: 1px solid #dfe6ec;
      padding-bottom: 10px;
      margin-bottom: 10px;
      font-weight: bold;
    }
  }
}
</style>
